﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TestYCHisJKPro
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            YCHisJKLib.HisJKClass JK = new YCHisJKLib.HisJKClass();
            string result = new string(' ',100);
            JK.DoAction("MZJL", "{\"RYBM\":\"304\",\"MZH\":\"0000001\",\"KSRQ\":\"20120701\",\"JSRQ\":\"20120731\"}", ref result);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string result = new string(' ', 100);
            string sText = "{\"RYBM\":\""+textBoxRYBM.Text+"\",\"MZH\":\""+textBoxMZH.Text+"\",\"KSRQ\":\""+textBoxKSRQ.Text+"\",\"JSRQ\":\""+textBoxJSRQ.Text+"\"}";

            DoJKAction("MZJL", sText, ref result);
        }

        [DllImport(@"YCHisJKLib.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern void DoJKAction([In, MarshalAs(UnmanagedType.BStr)] string AFunc, [In, MarshalAs(UnmanagedType.BStr)] string AData, [In, Out, MarshalAs(UnmanagedType.BStr)] ref string AResult);
    }
}
